package com.oliver.picturebackendcommon.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebMvcConfig
 * @Description TODO
 * @Author snow
 * @Date 2025/1/26 18:25
 **/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Bean
    public ConfigurableWebBindingInitializer configurableWebBindingInitializer() {
        ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
        initializer.setPropertyEditorRegistrar(registry -> {
            // 注册自定义编辑器
            registry.registerCustomEditor(String.class, new MvcStringEditor());
        });
        return initializer;
    }
}